package com.flexrrb.utils
{
	import flash.display.DisplayObjectContainer;
	import flash.geom.Point;
	
	import mx.controls.Menu;
	import mx.core.Application;

	public class SpecialMenu extends Menu
	{
		
		private static var menu:SpecialMenu;
		public function SpecialMenu()
		{
			super();
			labelField="@label";
			//addEventListener(MenuEvent.ITEM_CLICK, onItemClick, false, 0, true);
		}

		public static function createMenu(parent:DisplayObjectContainer, mdp:Object, showRoot:Boolean=true):SpecialMenu
		{
			if(menu){
				menu.hide();
			}
			menu=new SpecialMenu();
			menu.tabEnabled=false;
			menu.owner=DisplayObjectContainer(Application.application);
			menu.showRoot=showRoot;
			popUpMenu(menu, parent, mdp);
			return menu;
		}
		
		override public function show(xShow:Object=null, yShow:Object=null):void{
			super.show(xShow,yShow);
			//var pt:Point = new Point(Number(xShow), Number(yShow));
			//pt = LocationHelper.getFinalLocation(pt, this.height);
			//this.move(pt.x, pt.y);		
		}

	/*
	   private function onItemClick(e:MenuEvent):void
	   {
	   var data:XML = selectedItem as XML;
	   trace("menu parent: " + parent);
	   ApplicationFacade.getInstance().sendNotification(data.@notification, parentContainer);
	   }
	 */

	}
}